/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jeck.action.cu_evento.vertodos.bussiness;

import com.jeck.action.cu_evento.vertodos.data.Mg_showAllEvents;
import com.jeck.tools.Event;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author bicho
 */
public class ShowAllEventsFirst {
    public static List getEvents(){
        List events = new ArrayList();
        ResultSet rs = Mg_showAllEvents.getAllEvents();
        try {
            while (rs.next()) {
                Event ev = new Event(rs.getInt("id_evento"),
                        rs.getString("nombre"), rs.getString("descripcion"),
                        rs.getString("nombreadmin"), rs.getString("fecha_inicio"),
                        rs.getString("fecha_fin"));
                System.out.println("Añadido evento: "+rs.getString("nombre"));
                events.add(ev);
            }
        } catch (SQLException ex) {
            Logger.getLogger(ShowAllEventsFirst.class.getName()).log(Level.SEVERE, null, ex);
        }
        return events;
    }
}
